package auctionhausen

import groovy.transform.ToString;

class Customer {

	String email
	String password
	Boolean isAdmin = false // default
	Date dateCreated
	Date lastUpdated
	
	static hasMany = [listings : Listing, bids : Bid]
	static mappedBy = [listings : "seller"]
	
	static final Integer MIN_PASSWORD_SIZE = 6
	static final Integer MAX_PASSWORD_SIZE = 8
	
    static constraints = {
		email(unique : true, email : true, blank : false)
		password(size : MIN_PASSWORD_SIZE..MAX_PASSWORD_SIZE, blank : false)
    }
	
	String toString() {
		return email
	}
}
